package com.ruoyi.common.utils.excl.workbook;

import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.DataFormat;
import org.apache.poi.ss.usermodel.Workbook;

public class DataFormatStrategy implements CellStyleStrategy {

    private static DataFormatStrategy dataFormatStrategy = new DataFormatStrategy();

    private DataFormatStrategy(){};

    public static DataFormatStrategy getInstance() {
        return dataFormatStrategy;
    }

    @Override
    public void setTemplateCellStyle(Workbook workbook, CellStyle cellStyle) {
        DataFormat dataFormat = workbook.createDataFormat();
        cellStyle.setDataFormat(dataFormat.getFormat("@"));
    }
}
